package OnTheBeachDB::User;

use base qw/DBIx::Class/;

__PACKAGE__->load_components(qw/PK::Auto Core/);
__PACKAGE__->table('users');
__PACKAGE__->add_columns(

    userid => {
        data_type         => 'INT',
        size              => 11,
        is_nullable       => 0,
        is_auto_increment => 1
    },
   
    username => {
        data_type   => 'VARCHAR',
        size        => 200,
        is_nullable => 0,
    },

    password => {
        data_type   => 'VARCHAR',
        size        => 32,
        is_nullable => 0,
    },

    real_name => {
        data_type   => 'VARCHAR',
        size        => 200,
        is_nullable => 1,
    },

    location => {
        data_type   => 'VARCHAR',
        size        => 200,
        is_nullable => 1,
    },

    email => {
        data_type    => 'VARCHAR',
        size         => 200,
        is_nullable  => 1
    },
   
    about => {
        data_type    => 'TEXT',
        is_nullable  => 1,
    },

    confirmation_key => {
       data_type     => 'VARCHAR',
       is_nullable   => 0,
       size          => 32,
    },

    is_confirmed => {
       data_type   => 'TINYINT',
       is_nullable => 0,
       size        => 1,
    },

    created => {
       data_type   => 'DATETIME',
       is_nullable => 0, 
    },

    last_here => {
       data_type   => 'DATETIME',
       is_nullable => 0, 
    },

);
 
__PACKAGE__->set_primary_key('userid');

__PACKAGE__->has_many( map_user_role => 'OnTheBeachDB::UserRole', 'user_id');
#__PACKAGE__->has_many( comments      => 'OnTheBeachDB::Comments', 'comment_id' );
#__PACKAGE__->has_many( friends       => 'OnTheBeachDB::Friends',  'friend_id'  );


1;
